//
//  JBNewFeatureBeginBtn.m
//  OCsinaBlog
//
//  Created by jobo on 16/4/27.
//  Copyright © 2016年 jobo. All rights reserved.
//

#import "JBNewFeatureBeginBtn.h"
#import "JBTabBarController.h"
#import "JBOAuthViewController.h"
@interface JBNewFeatureBeginBtn()

@property (weak, nonatomic) IBOutlet UIButton *beginBtn;

@end

@implementation JBNewFeatureBeginBtn



+ (instancetype) beginBtn
{
    return [[[NSBundle mainBundle] loadNibNamed:@"JBNewFeatureBeginBtn" owner:nil options:nil] lastObject];

}
//开始微博
- (IBAction)beginBtnClick:(id)sender
{
    //跳转到主页
    
    //[UIApplication sharedApplication].keyWindow.rootViewController = tabarRootViewController ;
    //JBOAuthViewController *oauthVc = [[JBOAuthViewController alloc] init];
    //[UIApplication sharedApplication].keyWindow.rootViewController = oauthVc ;
    
    //保存当前版本号
    //获取当前版本号
    NSString *currenVersion = [[[NSBundle mainBundle] infoDictionary]objectForKey:(NSString *)kCFBundleVersionKey];
    //保存到沙盒
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults] ;
    [defaults setObject:currenVersion forKey:@"currenVersion"];
    [defaults synchronize] ;
    //判断是否登录过了,没有就到登录界面
    if([[NSUserDefaults standardUserDefaults] objectForKey:@"access_token"] != nil)
    {
        NSLog(@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"expires_in"]);
        NSLog(@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"remind_in"]);
        JBTabBarController *tabarRootViewController = [[JBTabBarController alloc] init] ;
        self.window.rootViewController = tabarRootViewController;
    }
    else
    {
        JBOAuthViewController *oauthVc = [[JBOAuthViewController alloc] init];
        self.window.rootViewController = oauthVc ;
    }

}
@end
